Fix interval text codec only parsing default intervalstyle#165
Merged
SeanTAllen merged 1 commit intomainfrom Mar 15, 2026
Merged
Fix interval text codec only parsing default intervalstyle#165SeanTAllen merged 1 commit intomainfrom
SeanTAllen merged 1 commit intomainfrom
Conversation
_IntervalTextCodec.decode() only handled the default postgres interval style. If a user changed their PostgreSQL session's intervalstyle setting, SimpleQuery results for interval columns would fail to decode. The text codec now detects and parses all four PostgreSQL intervalstyle formats via a dispatch heuristic: leading P → iso_8601, leading @ → postgres_verbose, any ASCII letter → postgres, otherwise sql_standard. Also fixes a pre-existing bug where mixed-sign postgres-style intervals with + prefixed tokens (e.g., +3 days) failed because Pony's String.i64() doesn't handle + prefix. Closes #145
840940d to
1e4e124
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_IntervalTextCodec.decode()only handled the defaultpostgresinterval style. If a user changed their PostgreSQL session'sintervalstylesetting, SimpleQuery results for interval columns would fail to decode. Binary format (used byPreparedQueryandNamedPreparedQuery) was never affected.The text codec now detects and parses all four PostgreSQL
intervalstyleformats via a dispatch heuristic: leadingP→iso_8601, leading@→postgres_verbose, any ASCII letter →postgres, otherwisesql_standard.Also fixes a pre-existing bug where mixed-sign postgres-style intervals with
+prefixed tokens (e.g.,+3 days) failed because Pony'sString.i64()doesn't handle+prefix (tracked separately in #164).Closes #145